<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>并非真正的常量(实例2)</title>
</head>

<body>
    <h2>JavaScript const</h2>

    <p>我们不能对常量对象重新赋值:</p>

    <p id="demo"></p>
    <script>
        try {
            const car = { type: "Fiat", model: "500", color: "white" };
            car = { type: "Volvo", model: "EX60", color: "red" }
        }
        catch (err) {
            document.getElementById("demo").innerHTML = err;
        }
    </script>
</body>

</html>